home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / latex209 / contrib / pslatex / fonts / makefonts.ps < prev    next >
Text File  |  1992-05-21  |  3KB  |  84 lines

  1. %!
  2. % PostScript code to generate derived fonts for PS-LaTeX
  3. %
  4. % Create a transformed font
  5. % params: symbol for name of new font,
  6. %         symbol for name of original font,
  7. %         font transformation matrix
  8. %         proc to execute on font (the transformed font dict is on the
  9. %               top of the stack when this proc is called)
  10. /TransformFont {
  11.   30 dict begin                 % for temporary storage
  12.     /Proc exch def              % the proc to exec
  13.     /TransformMatrix exch def   % transform matrix
  14.     /BaseName exch def          % existing font
  15.     /NewName exch def           % new name
  16.  
  17.         % find old font, apply transfrom
  18.     /BaseFontDict BaseName findfont TransformMatrix makefont def
  19.         % make a dictionary for the new font
  20.     /NewFont BaseFontDict maxlength dict def
  21.         % copy entries into the new dictionary (see Cookbook for expln.)
  22.     BaseFontDict
  23.       { exch dup /FID ne
  24.           { dup /Encoding eq
  25.               { exch dup length array copy
  26.                 NewFont 3 1 roll put }
  27.               { exch NewFont 3 1 roll put }
  28.             ifelse }
  29.           { pop pop }
  30.         ifelse
  31.       } forall
  32.     NewFont /FontName NewName put
  33.  
  34.         % call procedure
  35.     NewFont Proc
  36.         % store new font in fontdict
  37.     NewName NewFont definefont
  38.     pop
  39.   end
  40. } def
  41.  
  42. % Create an Oblique font
  43. % params:       new name for font
  44. %               old font
  45. %               angle of obliqueness
  46. /ObliqueFont {
  47.   20 dict begin
  48.     /Angle exch def
  49.     [1 0 Angle sin Angle cos div 1 0 0] % transform for obliqueness
  50.     {pop}
  51.     TransformFont
  52.   end
  53. } def
  54.  
  55. % Create a condensed font with different strokewidth
  56. % params:       new font name
  57. %               old font name
  58. %               factor to condense by (e.g., 0.8)
  59. %               factor to thicken lines by (e.g., 1.5)
  60. /CondensedFont {
  61.   20 dict begin
  62.     /LineThickening exch def
  63.     /WidthNarrowing exch def
  64.     [WidthNarrowing 0 0 1 0 0] % transform matrix
  65.     {dup /StrokeWidth get LineThickening mul /StrokeWidth exch put}
  66.     TransformFont
  67.   end
  68. } def
  69.  
  70. /Times-Oblique /Times-Roman 15 ObliqueFont
  71. /Times-BoldOblique /Times-Bold 15 ObliqueFont
  72. %/Times-ItalicUnslanted /Times-Italic -15.15 ObliqueFont
  73. /Symbol-Oblique /Symbol 15 ObliqueFont
  74. /Courier-Narrow /Courier 0.85 1.3 CondensedFont
  75.  
  76. % Can use these on a LaserWriter Plus
  77. /makeLWPlusFonts {
  78.   /Bookman-LightOblique /Bookman-Light 10 ObliqueFont
  79.   /NewCenturySchlbk-Oblique /NewCenturySchlbk-Roman 10 ObliqueFont
  80.   /Palatino-Oblique /Palatino-Roman 10 ObliqueFont
  81.   /Palatino-BoldOblique /Palatino-Bold 10 ObliqueFont
  82. } def
  83.  
  84.